package com.xie.smfs.effect;

import net.minecraft.entity.attribute.ClampedEntityAttribute;
import net.minecraft.entity.attribute.EntityAttribute;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;

public class SpiritAttributes {

    // 使用注册方法
    public static final EntityAttribute SPIRIT_RESISTANCE = register(
            "spirit_resistance", 50.0, 0.0, 100.0);  // 0-100%

    public static final EntityAttribute SPIRIT_DAMAGE = register(
            "spirit_damage", 10.0, 0.0, 500.0);      // 0-500伤害

    public static final EntityAttribute CURRENT_SPIRIT = register(
            "current_spirit", 50.0, 0.0, 10000.0);   // 0-10000当前灵力

    public static final EntityAttribute MAX_SPIRIT = register(
            "max_spirit", 1000.0, 0.0, 10000.0);     // 0-10000最大灵力

    public static final EntityAttribute REVIVAL_FACTOR = register(
            "revival_factor", 2.0, 0.0, 10.0);       // 0-10倍复活系数

    public static final EntityAttribute SANITY = register(
            "sanity", 0.0, 0.0, 100.0);              // 0-100理智值

    // 注册方法
    private static EntityAttribute register(String name, double defaultValue, double min, double max) {
        return Registry.register(
                Registries.ATTRIBUTE,
                new Identifier("smfs", name),
                new ClampedEntityAttribute("attribute.smfs." + name, defaultValue, min, max)
                        .setTracked(true)
        );
    }

    public static void register() {
        // 静态字段初始化时已经注册，这里可以留空或添加初始化逻辑
    }
}